var ueditor = {
	URLS : {
		uploadImg : '/shoplook/upload'
	},
	init:function(){
		UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
		UE.Editor.prototype.getActionUrl = function(action) {
			if (action == 'uploadimage') {
				return ueditor.URLS.uploadImg;
			} else {
				return this._bkGetActionUrl.call(this, action);
			}
		};
		return UE.getEditor('container', {
			toolbars : [ [ 'undo', 'redo', 'bold', 'italic', 'underline',
					'forecolor','fontfamily', 'fontsize','paragraph','justifyleft', 'justifyright',
					'justifycenter', 'justifyjustify', 'removeformat',
					'simpleupload', 'insertimage' ] ],
			autoHeightEnabled : true,
			autoFloatEnabled : true,
			imageUrlPrefix : "",
			imageManagerUrlPrefix : "",
			scrawlUrlPrefix : "",
			snapscreenUrlPrefix : "",
			catcherUrlPrefix : "",
			videoUrlPrefix : "",
			fileUrlPrefix : "",
			fileManagerUrlPrefix : "",
			initialFrameHeight : 500,
            initialFrameWidth: '100%'
            //粘贴只保留标签，去除标签所有属性
            ,retainOnlyLabelPasted: true

            ,pasteplain:true  //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
            //纯文本粘贴模式下的过滤规则
            ,'filterTxtRules' : function(){
               function transP(node){
                   node.tagName = 'p';
                   node.setStyle();
               }
               return {
                   //直接删除及其字节点内容
                   '-' : 'script style object iframe embed input select',
                   'p': {$:{}},
                   'br':{$:{}},
                   'div':{$:{}},
                   'li':{$:{}},
                   'caption':{$:{}},
                   'th':{$:{}},
                   'tr':{$:{}},
                   'h1':{$:{}},'h2':{$:{}},'h3':{$:{}},'h4':{$:{}},'h5':{$:{}},'h6':{$:{}},
                   'td':function(node){
                       //没有内容的td直接删掉
                       var txt = !!node.innerText();
                       if(txt){
                           node.parentNode.insertAfter(UE.uNode.createText(' &nbsp; &nbsp;'),node);
                       }
                       node.parentNode.removeChild(node,node.innerText())
                   }
               }
            }()

		});
	}
};
var ue = ueditor.init();
